﻿@model BOL.tbl_Url

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Manage Urls</h2>
@if (TempData["Msg"] != null)
{ <div class="alert alert-dismissable alert-info">
     <button type="button" class="close" data-dismiss="alert">×</button>
        @TempData["Msg"].ToString()
    </div>}
    
@using (Html.BeginForm("Create","URL",FormMethod.Post)) 
{
    @Html.AntiForgeryToken()
    
    <div class="form-horizontal">
        <hr />
        @Html.ValidationSummary(true)

        <div class="form-group">
            @Html.LabelFor(model => model.UrlTitle, new { @class = "control-label col-md-2" })
            <div class="col-md-4">
                @Html.TextBoxFor(model => model.UrlTitle, new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.UrlTitle, null, new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Url, new { @class = "control-label col-md-2" })
            <div class="col-md-4">
                @Html.TextBoxFor(model => model.Url, new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.Url, null, new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.UrlDesc, new { @class = "control-label col-md-2" })
            <div class="col-md-4">
                @Html.TextBoxFor(model => model.UrlDesc, new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.UrlDesc, null, new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.CategoryId, "CategoryId", new { @class = "control-label col-md-2" })
            <div class="col-md-4">
                @Html.DropDownList("CategoryId", (IEnumerable<SelectListItem>)ViewBag.CategoryId, new { @class = "form-control" })
                @Html.ValidationMessageFor(model => model.CategoryId, null, new { @class = "text-danger" })
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-offset-2 col-md-4">
                <input type="submit" value="Create" class="btn btn-primary" />
            </div>
        </div>
    </div>
}

